package com.lmn.controller;

import io.swagger.annotations.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.*;

@Api(value = "影城配置", tags = {"影城后台配置"})
@RestController
@RequestMapping("test")
public class ControllerTest {
    private static final Logger LOG = LoggerFactory.getLogger(ControllerTest.class);

    @ApiOperation(value = "修改影城退改签配置", notes = "输入参数为影城退改签配置的json")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "name", value = "姓名", dataTypeClass = String.class, required = true),
            @ApiImplicitParam(name = "age", value = "年龄", dataType = "int", required = true)
    })
    @GetMapping("get")
    public String get(@RequestParam String name, int age) {
        LOG.info("name:" + name + "\tage:" + age);
        return "success";
    }

    @PutMapping("put")
    public String put(@RequestBody Body body) {
        LOG.info("body:" + body.toString());
        return "success";
    }

    @ApiOperation(value = "post body体请求", notes = "post body体请求", httpMethod = "POST")
    @ApiResponses({
            //code重复的情况下，第一个声明的生效。
            @ApiResponse(code = 200, message = "成功"),
            @ApiResponse(code = 202, message = "删除")
    })
    @PostMapping("post")
    public String post(@RequestBody Body body) {
        LOG.info("body:" + body.toString());
        return "success";
    }

    @DeleteMapping("delete")
    public String delete(@RequestParam String id) {
        LOG.info("id:" + id);
        return "success";
    }
}
